﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;

namespace Demo_自定义标签.Controllers
{
    public class InnerTagController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }

        [Route("/Employee/Details/{empId:int}")]
        public IActionResult Details(int empId)
        {
            return View();
        }

        [Route("/Employee/Employeeval", Name = "Employeeeval")]
        public IActionResult Details() => View();

        [Route("/Employee/EvaluationsCurrent", Name = "EvaluationsCurrent")]
        public IActionResult Evaluations(int id, bool currentYear) => View();

        [Route("/Employee/Countries")]
        public IActionResult Select()
        {
            var model = new CountryViewModel();
            return View(model);
        }

    }


    public class CountryViewModel
    {

        public string Country { get; set; } = "2";

        public Language Language { get; set; } = Language.Amereca;


        public static SelectListGroup group1 = new SelectListGroup() { Name = "组一" };
        public static SelectListGroup group2 = new SelectListGroup() { Name = "组二", Disabled = true };
        public static SelectListGroup group3 = new SelectListGroup() { Name = "组三" };

        public List<SelectListItem> Countries = new List<SelectListItem>()
        {
            new SelectListItem(){ Text="中国",Value="1",Group=group1 },
            new SelectListItem(){ Text="日本",Value="2", Group=group1 },
            new SelectListItem(){ Text="西班牙",Value="3",Group=group2 },
            new SelectListItem(){ Text="菲律宾",Value="4",Group=group2 },
            new SelectListItem(){ Text="新加坡",Selected=true,Value="5",Group=group3 },
        };


    }

    public enum Language
    {
        [Display(Name ="中国")]
        Chinese = 0,
        [Display(Name ="美国")]
        Amereca = 1,
        [Display(Name = "日本")]
        Japan = 2,
        [Display(Name = "西班牙")]
        Spain = 3
    }
}